<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>test</title>
    </head>
    <body>

        <?php
        include 'banner-create.php';
        include 'dbFiles.php';
        include 'configbanners.php';

        $db = new mysqli($idbhost, $idbuser, $idbpass, $idbname);
        if ($db->connect_errno) {
            $debugpage .= "MYSQLiConnect Error:" . $db->connect_errno . ") " . $db->connect_error . "<br />";
            print $debugpage;
        }
        $images = GetFilesList($db, $sourcefolder);
        if (count ($images) > 0) {
                    foreach (glob($destfolder."*.jpg") as $filename) {
                    echo "Deleting $filename<br />";
                    unlink($filename);
                }
                echo "Deletion Complete.. <br />";

            }
        ini_set('max_execution_time', 0);
        ini_set("gd.jpeg_ignore_warning", 1);
        ini_set('memory_limit', '100M');   //  handle large images
        foreach ($images as $index => $image) {
            echo '<img src="' . $sourcefolder . $image . '" alt="' . $image . '" height="50">';
            $thisimage = FilmStrip($images, $index, 2000, 180, $logo);
            if ($thisimage === false) {
                echo 'no image';
            } else {
                $filename = sprintf("Banner-%06s.jpg", $index);
                $filed = imagejpeg($thisimage, $destfolder . $filename, $quality);
                if ($filed === true) {
                    echo '<img src="' . $destfolder . $filename . '" alt="' . $image . '">';
                } else {
                    echo 'No Strip.. ' . $destfolder . $filename . " - " . $image . "<br />";
                }
            }
        }
        ?>

    </body>
</html>
